package com.mark.design.pattern.creational.prototype;

/**
 * Created by Choisaaaa on 2018/8/20.
 */
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        Mail mail = new Mail();
        mail.setContent("初始化模板");
        System.out.println("原始对象"+mail);
        for (int i = 0; i<10;i++) {
            Mail mail1Tempalte = (Mail) mail.clone();
            System.out.println("克隆对象"+mail1Tempalte);
            mail.setName("姓名" + i);
            mail.setEmailAddress("姓名"+i+"@imooc.com");
            mail.setContent("恭喜你，此次慕课网活动中奖了");
            MailUtil.sendMail(mail);
        }
        MailUtil.saveOriginMailRecord(mail);

    }
}
